package com.tmt.im.common.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tmt.im.common.annotation._AllowUpdate;
import com.tmt.im.common.enums.RedPackageType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.apache.ignite.cache.query.annotations.QuerySqlField;

import java.io.Serial;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/9/2 13:17
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class RedPackagePoJo implements IGetKey<Long> {

    @Serial
    private static final long serialVersionUID = 7417038832668215747L;

    public static final String CACHE_NAME = "red_package";

    @QuerySqlField(name = "id", index = true)
    private Long id;

    @QuerySqlField(name = "title")
    private String title;

    @QuerySqlField(name = "skin_id")
    private Long skinId;

    @QuerySqlField(name = "type")
    private String type;

    @QuerySqlField(name = "amount")
    @JsonIgnore
    private Long amount;

    @QuerySqlField(name = "split_count")
    @JsonIgnore
    private int splitCount;

    @QuerySqlField(name = "received_already")
    @_AllowUpdate
    private boolean receivedAlready;

    @QuerySqlField(name = "receiver_ids")
    private String receiverIds;

    @QuerySqlField(name = "session_id")
    private Long sessionId;

    @QuerySqlField(name = "creator_id")
    @JsonIgnore
    private Long creatorId;

    @QuerySqlField(name = "create_time")
    private Timestamp createTime;

    @QuerySqlField(name = "version")
    @_AllowUpdate
    private Long version;

    @JsonIgnore
    private boolean insert;

    @Override
    public Long getKey() {
        return id;
    }
}
